<template>
	<div class="feedingPlan zy-content">
		<div class="searchBox search-box-layout">
			<Row :gutter="24">
				<Col span="4">
					<div>
						<p class="label">任务号</p>
						<div class="ipt">
							<Input type="text" v-model="searchParams.taskNumber" clearable :placeholder="`${$t('common.inputInfo')}`" :maxlength="32" />
						</div>
					</div>
				</Col>
				<Col span="4">
					<div>
						<p class="label">工序</p>
						<div class="ipt">
							<Input type="text" v-model="searchParams.workingProcedure" clearable :placeholder="`${$t('common.inputInfo')}`" :maxlength="32" />
						</div>
					</div>
				</Col>
				<Col span="4">
					<div>
						<p class="label">状态</p>
						<div class="ipt">
							<Select v-model="searchParams.status" clearable>
								<Option value="全部">全部</Option>
								<Option value="0">待投料</Option>
								<Option value="1">部分投料</Option>
								<Option value="2">已投料</Option>
								<Option value="3">关闭</Option>
								<!-- <Option value="4">完工</Option> -->
							</Select>
						</div>
					</div>
				</Col>
				<Col span="4">
					<div>
						<p class="label">产出编号</p>
						<div class="ipt">
							<Input type="text" v-model="searchParams.outputCode" clearable :placeholder="`${$t('common.inputInfo')}`" :maxlength="32" />
						</div>
					</div>
				</Col>
				<Col span="4">
					<div>
						<p class="label">工序投入物料编号</p>
						<div class="ipt">
							<Input type="text" v-model="searchParams.inputMaterialCode" clearable :placeholder="`${$t('common.inputInfo')}`" :maxlength="32" />
						</div>
					</div>
				</Col>
				<Col span="4">
					<div>
						<p class="label hide-label">--</p>
						<div class="ipt">
							<Button class="search-btn" type="primary" @click="changeNum()">
								{{ $t('common.Query') }}
							</Button>
							<Button class="reset-btn" @click="reset()">
								{{ $t('common.reset') }}
							</Button>
						</div>
					</div>
				</Col>
			</Row>
		</div>
		<div class="list-layout mt16">
			<!-- 批量删除 批量导出  批量导入 下载模板 新增-->
			<div class="btns clear">
				<span class="title">{{ $t('common.listInformation') }}</span>
				<Button type="primary" @click="shengCheng">生成领料任务</Button>
				<!-- <Button @click="printShowChange">领料单打印</Button> -->
				<!--<Button @click="guanBi">关闭</Button>-->
				<!--<Button @click="wanGong">强制完工</Button>-->
				<Button @click="exportTemplateClick">{{ $t('common.batchExport') }}</Button>
			</div>
			<!-- 表格 -->
			<div class="tableContent">
				<Table
					class="resizable-table"
					border
					@on-column-width-resize="onColumnWidthResize"
					:columns="columns"
					ellipsis
					ref="selection"
					stripe
					:data="dataArr"
					@on-selection-change="onSelectChange"
				>
				</Table>
			</div>

			<!-- 分页 -->
			<div class="pageWrap mt16">
				<pageLeftTitle :total="total" :selected="delIds.length" />
				<Page
					:total="total"
					:page-size="pageSize"
					:page-size-opts="pageSizeOption"
					:current="pageNum"
					@on-change="changePageNum"
					@on-page-size-change="changePageSize"
					show-sizer
					show-total
				/>
			</div>
		</div>
		<Modal :mask-closable="false" v-model="printShow" :title="$t('common.Delete')" class="modal-title-layout">
			<div class="print-wrap" id="printWrapId"></div>
			<div slot="footer">
				<Button type="default" @click="printShow = false">{{ $t('common.Cancle') }}</Button>
				<Button type="primary" :loading="loading" @click="onPrint">{{ $t('maintenance.Confirmed') }}</Button>
			</div>
		</Modal>
		<Modal :mask-closable="false" v-model="lltaskShow" title="生产领料任务" class="modal-title-layout">
			<div class="print-wrap" id="printWrapId"></div>
			<div slot="footer">
				<Button type="default" @click="lltaskShow = false">{{ $t('common.Cancle') }}</Button>
				<Button type="primary" :loading="loading" @click="onPrint">{{ $t('maintenance.Confirmed') }}</Button>
			</div>
		</Modal>
		<addTask ref="addTask" @changeNum="changeNum"></addTask>
	</div>
</template>

<script>
  import {searchApi, exportApi} from "@/api/planManage/feedingPlan.js";
  import fileDownload from "js-file-download";
  import addTask from "./modules/materialRequisitionTask.vue";
  import toggleTableOperation from "@/mixins/toggleTableOperation";
  export default {
    name: "feedingPlan",
    components:{addTask},
    mixins: [toggleTableOperation],
    data() {
      return {
        searchParams: {
          status: "全部"
        },
        columns: [
          {
            key: "selection",
            type: "selection",
            width: 60,
            align: "center"
          },
          {
            title: `${this.$t("common.index")}`,
            type: 'index',
            width: 100,
            align: 'center'
          },
          {
            title: "任务号",
            key: "taskNumber",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "工序",
            key: "workingProcedure",
            minWidth: 100,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "状态",
            key: "status",
            minWidth: 100,
            align: "center",
            resizable: true,
            tooltip:true,
            render: (h, params) => {
              return h(
                "div",
                params.row.status === 0 ? '待投料' : params.row.status === 1 ? '部分投料' : params.row.status === 2 ? '已投料' : params.row.status === 3 ? '关闭' : params.row.status === 4 ? '完工' : ''
              );
            },
          },
          {
            title: "产出编号",
            key: "outputCode",
            minWidth: 100,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "工序投入物料编号",
            key: "inputMaterialCode",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "计划投料数量",
            key: "planQuantity",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "待领料数量",
            key: "quantityToPicked",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "出库数量",
            key: "outboundQuantity",
            minWidth: 100,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "实际投料数量",
            key: "actualFeedingQuantity",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "出库次单位数量",
            key: "outboundUnitsNumber",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "实际投料次单位数量",
            key: "actualFeedingQuantityUnit",
            minWidth: 180,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "投料单位",
            key: "feedingUnit",
            minWidth: 100,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "剩余投料数量",
            key: "remainingFeedingQuantity",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "退料数量",
            key: "returnQuantity",
            minWidth: 100,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "退料次单位数量",
            key: "materialReturnFrequency",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "计划时间",
            key: "plannedTime",
            minWidth: 170,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "客户",
            key: "customer",
            minWidth: 100,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "工厂",
            key: "locationName",
            minWidth: 170,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "生产计划号",
            key: "productionPlanNumber",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "创建人",
            key: "createName",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "创建时间",
            key: "createTime",
            minWidth: 180,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "更新人",
            key: "updateName",
            minWidth: 160,
            align: "center",
            resizable: true,
            tooltip:true,
          },
          {
            title: "更新时间",
            key: "updateTime",
            minWidth: 180,
            align: "center",
            resizable: true,
            tooltip:true,
          }
        ],
        dataArr: [],
        total: 0,
        pageNum: 1,
        pageSize: 10,
        pageSizeOption: [10, 20, 30, 40],
        allCheck: false,
        delIds: [],
        taskList: [],
        loading: false,
        printShow: false,
        lltaskShow: false,
      };
    },
    mounted() {
      this.getTableColumnsWidth(this.columns);
      this.searchList();
    },
    methods: {
      //重置
      reset() {
        this.searchParams = {
          status: "全部"
        };
        this.changeNum();
      },
      //分页
      changeNum() {
        this.pageNum = 1;
        this.delIds = [];
        this.searchList();
      },
      changePageSize(pageSize) {
        this.pageSize = pageSize;
        this.searchList();
      },
      changePageNum(val) {
        this.pageNum = val;
        this.searchList();
      },
      //查询列表
      searchList() {
        let params = {
          ...this.searchParams,
          pageNum: this.pageNum,
          pageSize: this.pageSize
        };
        if (params['status'] === '全部') {
          params['status'] = '';
        }
        searchApi(params).then(res => {
          if (res.code === 200) {
            this.dataArr = res.data.records;
            this.total = res.data.total;
          } else {
            this.$Message.warning({
              content: res.msg,
              duration: 6,
              closable: true
            });
          }
        });
      },
      //勾选列表
      onSelectChange(selection) {
        let myArray = [];
        let taskList = [];
        selection.map((item) => {
          myArray.push(item.id);
          taskList.push(item);
        });
        this.delIds = myArray;
        this.taskList = taskList;
        if (selection.length > 0) {
          this.allCheck = true;
        } else {
          this.allCheck = false;
        }
      },
      shengCheng() {
        if (this.taskList.length !== 1) {
          this.$Message.warning({
            content: `请选择一项数据`,
            duration: 6,
            closable: true
          });
          return false;
        }
        this.$refs.addTask.createfaultCodeShowH(this.taskList);
      },
      printShowChange() {
        if (this.delIds.length === 0) {
          this.$Message.warning({
            content: `请选择至少一项数据`,
            duration: 6,
            closable: true
          });
          return false;
        } else {
          // this.printShow = true;
        }
      },
      onPrint() {
        let prnhtml = document.getElementById('printWrapId').innerHTML;


        let iframe = document.createElement('iframe');
        iframe.setAttribute('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;');
        let doc = null;
        document.body.appendChild(iframe);

        doc = iframe.contentWindow.document;

        let style = '';
        switch (this.printInfo.type) {
          case 'CAT':
            style = '.print{padding: 55px;}';
            break;
          case 'SOC':
            this.$router.push({
              path: "/capital",
              query: {
                id: this.printInfo.info.id
              }
            });

            return;
            // style = '.print {width: 1320px;}.print {transform: scale(0.3, 0.3);transform-origin: left top;padding: 32px;padding-top: 80px !important;}.tLogo {display: inline-block;z-index: 111;-webkit-print-color-adjust: exact;}.head-title {text-align: center;background-color: #5c6f7b !important;font-weight: bold;font-size: 26px;line-height: 40px;color: #FFFFFF !important;-webkit-print-color-adjust: exact;border: #000 solid 1px;}.label {font-size: 14px;font-weight: bold;color: #333333;line-height: 20px;padding: 0;margin: 0;border: none;}.desc {font-size: 14px;color: #333333;}.head-wrap ul {display: inline-block;}.head-wrap ul.r {float: right;padding-right: 60px;}.head-wrap li {margin-top: 10px;}.head-wrap li .label {width: 180px;display: inline-block;text-align: left;border: none;}.head-wrap li .ipt {width: 180px;border-bottom: #333333 solid 1px;font-size: 13px;color: #333333;display: inline-block;font-weight: bold;padding-left: 3px;box-sizing: border-box;}.bg-head {background: #d9d9d9 !important;-webkit-print-color-adjust: exact;}.bg-head span {padding-left: 3px;font-weight: bold;font-size: 14px;text-decoration: underline;color: #333333;}.ipt-content-wrap ul {padding: 7px 0 0 0;}.ipt-content-wrap li {display: inline-block;padding-bottom: 7px;vertical-align: top;}.ipt-content-wrap li.bp {width: 208px;}.ipt-content-wrap li.bp1 {width: 262px;}.ipt-content-wrap li.bp2 {width: 360px;}.ipt-content-wrap li .radio-br {width: 60px;height: 20px;border: #333 solid 1px;display: inline-block;vertical-align: bottom;margin-right: 3px;}.pTextarea {border: #333 solid 1px;min-height: 115px;margin: 5px 0;padding: 5px;font-size: 14px;}.department {border: #333 solid 1px;}.department .info-wrap li {display: inline-block;width: 180px;vertical-align: top;padding-bottom: 0;}.department .info-wrap li span {display: block;text-align: left;}.department .info-wrap li .label {height: 20px;}.department .info-wrap li .ipt {width: 180px;border-bottom: #333333 solid 1px;font-size: 13px;color: #333333;display: inline-block;font-weight: bold;padding-left: 3px;box-sizing: border-box;margin-top: 44px;height: 22px;line-height: 22px;}.department .label-title {text-decoration: underline;}.iptImage {height: 40px;padding-top: 26px;border-bottom: #333333 solid 1px;font-size: 13px;color: #333333;display: inline-block;font-weight: bold;padding-left: 3px;box-sizing: content-box;}.iptImage img {height: 40px;width: auto;padding: 0;}.table-list {border: #333 solid 1px;margin-top: 5px;}.table-list .table {padding-left: 5px;margin-bottom: 0;padding-top: 0;margin-top: 0;padding-top: 0;}.table-list .table li {color: #333333;display: inline-block;margin-right: 40px;border-radius: 0;}.table-list .table li:nth-child(1) {width: 35px;text-align: left;}.table-list .table li:nth-child(2) {width: 120px;text-align: left;}.table-list .table li:nth-child(3) {width: 180px;}.table-list .table li:nth-child(4) {width: 360px;}.table-list .table li:nth-child(5) {width: 60px;text-align: right;}.table-list .table li:nth-child(6) {width: 60px;text-align: right;}.table-list .table li:nth-child(7) {width: 120px;text-align: right;}.table-list .table li.ipt {border-bottom: #333 solid 1px;padding-bottom: 1px;font-size: 14px;vertical-align: text-bottom;}.table-list .info-wrap {margin: 5px;padding-top: 0;}.table-list .info-wrap li {display: inline-block;vertical-align: bottom;margin-right: 200px;padding-bottom: 0;}.table-list .info-wrap li:last-child {margin-right: 0;}.table-list .info-wrap li span {display: block;text-align: left;}.table-list .info-wrap li .ipt {width: 180px;border-bottom: #333333 solid 1px;font-size: 13px;color: #333333;display: inline-block;font-weight: bold;padding-left: 3px;box-sizing: border-box;padding-top: 35px;height: 20px;}.approval {margin-top: 5px;}.approval .br {border: #333333 solid 1px;margin: 3px 0;}.approval .btm-br {border-top: #333333 solid 1px;padding: 3px;}.approval .info-wrap {margin: 5px;padding-top: 0;padding-left: 60px;}.approval .info-wrap li {display: inline-block;vertical-align: bottom;margin-right: 200px;padding-bottom: 0;}.approval .info-wrap li:last-child {margin-right: 0;}.approval .info-wrap li span {display: block;text-align: left;}.approval .info-wrap li .ipt {width: 180px;border-bottom: #333333 solid 1px;font-size: 13px;color: #333333;display: inline-block;font-weight: bold;padding-left: 3px;box-sizing: border-box;padding-top: 66px;}.end-wrap {text-align: right;padding-right: 74px;}.end-wrap .number {border-bottom: #333333 solid 1px;width: 120px;display: inline-block;margin-left: 40px;}'
            break;
          case 'PAY':
            style = '.print {padding: 40px;}.page-title .z {font-weight: bold;font-size: 16px;display: block;}.page-title .f {font-size: 14px;}.head-info-wrap {position: relative;}.head-info-wrap .desc1 {font-size: 12px;width: 224px;text-align: right;display: inline-block;padding-right: 7px;font-weight: 600;box-sizing: border-box;}.head-info-wrap .desc2 {font-weight: 600;font-size: 12px;padding-left: 51px;}.head-info-wrap table {border-color: black !important;width: 490px;border: #000 solid 2px;vertical-align: bottom;}.head-info-wrap table tr td {font-size: 12px;padding: 0 2px;border: #000 solid 2px;height: 20px;line-height: 18px;}.head-info-wrap table tr td p, .head-info-wrap table tr td span {font-size: 12px;}.head-info-wrap table tr td:nth-child(1) {width: 77px;}.head-info-wrap table tr td:nth-child(2) {width: 17px;}.head-info-wrap table tr td:nth-child(3) {width: 97px;text-align-last: justify;text-align: justify;text-justify: distribute-all-lines;}.head-info-wrap table tr td:nth-child(4) {width: 33px;text-align: center;}.head-info-wrap table tr td .radio-image {margin: 0 auto 0;}.head-info-wrap table tr td .left-label {display: inline-block;width: 56px;}.head-info-wrap table tr td.no-btm-br {border: none;}.head-info-wrap table tr td .justify {width: 56px;}.head-info-wrap .right-wrap {display: inline-block;width: calc(100% - 490px);position: absolute;right: 0;bottom: 0;}.head-info-wrap .right-wrap ul li span {font-size: 12px;display: block;}.head-info-wrap .right-wrap ul li span:nth-child(1) {line-height: 1;margin-left: 4px;}.head-info-wrap .right-wrap ul li .ipt {height: 20px;border-bottom: #333 solid 1px;width: 125px;margin-left: 95px;margin-bottom: 10px;font-weight: bold;}.radio-image img {width: 14px;}.c-text {font-size: 12px;font-weight: 600;}.money-wrap .money-type {border: #000000 solid 2px;padding: 1px 5px;width: 75px;display: inline-block;}.money-wrap .money-type .radio-image {display: inline-block;}.my-content {display: inline-block;width: calc(100% - 80px);padding-left: 5px;vertical-align: top;}.my-content .ctn-wrap {border-bottom: #000 solid 1px;}.my-content .ctn-wrap ul {height: 22px;display: inline-block;}.my-content .ctn-wrap ul li {width: 16px;height: 20px;display: inline-block;border-right: #000 solid 1px;border-top: #000 solid 1px;vertical-align: text-top;line-height: 20px;text-align: center;font-weight: bold;}.my-content .ctn-wrap ul li:first-child {border-left: #000 solid 1px;}.my-content .ctn-wrap .p-t {display: inline-block;font-size: 12px;padding-left: 5px;vertical-align: bottom;}.my-content .ipt {width: 50px;height: 18px;border: #000 solid 1px;display: inline-block;margin-left: 15px;margin-top: 7px;}.my-content .c-text {margin-left: 150px;vertical-align: top;position: relative;top: 8px;}.dept-branch {font-size: 12px;}.dept-branch .ipt {height: 20px;line-height: 20px;border-bottom: #000 solid 1px;font-weight: bold;font-size: 12px;width: 200px;}.label {border: none !important;}.invoice-attached .label {font-size: 12px;font-weight: bold;color: #000000;padding: 0;}.invoice-attached td {border: #000 solid 2px;padding: 5px !important;}.manager .item {width: calc(100% / 3);display: inline-block;}.manager1 .item {width: calc(100% / 3);display: inline-block;}.manager1 .item:first-child {width: calc(100% / 3 * 2);}.money-table {border-collapse: collapse;box-sizing: border-box;float: left;}.money-table td {box-sizing: border-box;border-collapse: collapse;}'
            break;
          case 'FAT':
            style = '.print {padding: 55px;}.hl2 {height: 52px;line-height: 52px;width: 100%;text-align: center;}.hl1 {height: 26px;line-height: 26px;width: 100%;text-align: center;}'
            break;
          case 'CAP':
            style = '.print {padding: 50px 32px 32px 32px;width: 1200px;}.tLogo {position: absolute !important;display: inline-block;left: initial;top: 50px;right: 55px;}.title-wrap {width: 100%;text-align: center;font-family: SimSun;}.title-wrap .name {font-weight: 600;font-size: 19px;line-height: 40px;}.title-wrap .name-en {font-weight: 600;font-size: 14px;margin-top: 3px;line-height: 0;}.head-wrap .left {display: inline-block;}.head-wrap .right {display: inline-block;float: right;vertical-align: bottom;padding-right: 80px;}.head-wrap .line {border-bottom: #333 solid 1px;height: 20px;vertical-align: text-bottom;width: 120px;display: inline-block;margin-left: 10px;}.bg-head {background: #d9d9d9 !important;-webkit-print-color-adjust: exact;}.bg-head span {padding-left: 3px;font-weight: bold;font-size: 14px;text-decoration: underline;color: #333333;}.label {font-size: 14px;font-weight: bold;color: #333333;line-height: 20px;padding: 0;margin: 0;border: none;}.info-wrap {margin-top: 17px;}.info-wrap li {display: inline-block;vertical-align: top;padding-bottom: 0;margin-right: 120px;}.info-wrap li:last-child {margin-right: 0;}.info-wrap li span {display: block;text-align: left;}.info-wrap li .label {height: 20px;display: inline-block;margin-right: 65px;font-weight: normal;}.info-wrap li .ipt {width: 180px;border-bottom: #333333 solid 1px;font-size: 13px;color: #333333;display: inline-block;font-weight: bold;padding-left: 3px;box-sizing: border-box;height: 22px;line-height: 22px;}.iptLine {width: 180px;border-bottom: #333333 solid 1px;font-size: 13px;color: #333333;display: inline-block;font-weight: bold;padding-left: 3px;box-sizing: border-box;height: 22px;line-height: 22px;text-align: center;}.label1 {text-align: left;width: 106px;}.ipt-content-wrap ul {padding: 7px 0 0 0;}.ipt-content-wrap li {display: inline-block;padding-bottom: 7px;vertical-align: top;}.ipt-content-wrap li.bp {width: 208px;}.ipt-content-wrap li.bp1 {width: 262px;}.ipt-content-wrap li.bp2 {width: 365px;}.ipt-content-wrap li .radio-br {width: 60px;height: 20px;border: #333 solid 1px;display: inline-block;vertical-align: bottom;margin-right: 3px;}.table-list {margin-top: 5px;}.table-list .table {padding-left: 5px;margin-bottom: 0;padding-top: 0;margin-top: 0;padding-top: 0;}.table-list .table li {color: #333333;display: inline-block;margin-right: 30px;border-radius: 0;}.table-list .table li:last-child {margin-right: 0;}.table-list .table li:nth-child(1) {width: 35px;text-align: left;}.table-list .table li:nth-child(2) {width: 120px;text-align: left;}.table-list .table li:nth-child(3) {width: 180px;}.table-list .table li:nth-child(4) {width: 360px;}.table-list .table li:nth-child(5) {width: 60px;text-align: right;}.table-list .table li:nth-child(6) {width: 60px;text-align: right;}.table-list .table li:nth-child(7) {width: 120px;text-align: right;}.table-list .table li.ipt {padding-bottom: 1px;font-size: 14px;}.table-list .info-wrap {margin: 5px;padding-top: 0;}.table-list .info-wrap li {display: inline-block;vertical-align: bottom;margin-right: 200px;padding-bottom: 0;}.table-list .info-wrap li:last-child {margin-right: 0;}.table-list .info-wrap li span {display: block;text-align: left;}.table-list .info-wrap li .ipt {width: 180px;border-bottom: #333333 solid 1px;font-size: 13px;color: #333333;display: inline-block;font-weight: bold;padding-left: 3px;box-sizing: border-box;padding-top: 35px;height: 20px;}.end-wrap {text-align: right;padding-right: 14px;padding-top: 20px;}.end-wrap .number {border-top: #333333 solid 1px;border-bottom: #333333 solid 1px;width: 120px;display: inline-block;margin-left: 40px;position: relative;}.end-wrap .number::before {content: \'\';width: 120px;border: #333333 solid 1px;position: absolute;top: 24px;right: 0;}.tb-wrap .label-title {display: inline-block;margin-right: 60px;}.tb-wrap ul {display: inline-block;vertical-align: top;padding-top: 0;}.tb-wrap ul li {display: block;}.text-p-wrap .left {display: inline-block;width: 720px;}.text-p-wrap .right {display: inline-block;}.info-wrap-write {padding-top: 20px !important;border: #333 solid 1px;}.info-wrap-write li {display: inline-block;width: 180px;vertical-align: top;padding-bottom: 0;}.info-wrap-write li span {display: block;text-align: left;}.info-wrap-write li .label {height: 20px;}.info-wrap-write li .ipt {width: 180px;border-bottom: #333333 solid 1px;font-size: 13px;color: #333333;display: inline-block;font-weight: bold;padding-left: 3px;box-sizing: border-box;margin-top: 20px;height: 40px;}'
            break;
          case 'SAT' :
            style = '.print{padding: 55px;}'
            break;
        }

        doc.write(`<style> *{font-family: "Roboto",arial,sans-serif !important;font-size: 15px;list-style: none;}.wrap{padding-top:100px;padding-bottom:100px;background:#404040;}.print-wrap{width:21cm;margin:0 auto;}.print{width:21cm;height:auto;margin:0 auto 50px;background:#ffffff;padding:20px;box-sizing:border-box;page-break-after:always;position:relative;}.print:last-child{margin-bottom:0;}.print .header{margin-bottom:30px;border-bottom:1px solid #000;}.print .header .logo{display:inline-block;width:110px;vertical-align: bottom;}.print .header .title-wrap{font-family:SimSun;width:calc(100% - 138px);display:inline-block;}.print .header .title-wrap p{text-align:center;line-height:25px;}.print .header .title-wrap .name{font-weight:600;font-size:21px;line-height:1;}.print .header .title-wrap .name-en{font-weight:600;font-size:14px;margin-left:55px;margin-top:3px;line-height:0;}.print table{position:relative;width:100%;table-layout:fixed;border-color:#000;border-width:2px;}.print table .borderNone{border:none;border-color:transparent;}.print table td{padding:5px;vertical-align:top;line-height: 1;height: 10px}.print table .text{font-size:14px;margin: 0;line-height: 26px}.print table .text-en{font-size:15px;font-weight:500;line-height: 26px;margin:0;}.print table p{line-height:26px !important;color:#333;padding: 0 !important;}.w50{width:50%;}.w100{width:100%;}.w33{width:calc(100% / 3);}.radio{display:inline-block;width:12px;height:12px;border:#333 solid 2px;line-height:1;margin:0;padding:0;vertical-align:baseline;margin-right:5px;}.underline{text-decoration:underline;}.ft{position:fixed;bottom:20px;color:#000;width:calc(100% - 32px);left:16px;font-size:14px;display:none;}.ft span{font-weight:500;position:absolute;right:0;bottom:0;}.tLogo{position:fixed;top:28px;left:1178px;display:none;}.tLogo img{width:50px;}.bold{font-weight:bold;}.underline{text-decoration:underline;}.descText{white-space:pre;line-height:17px !important;}.nowrap td{text-align:center;}.nowrap p{white-space:nowrap;}.breakWord p{word-break:break-all;}.signPathWrap img{width:50%;display:inline-block;}.list-item-text td{line-height:1;word-break:break-all;padding:5px 0 !important;}@media print{.print{margin-bottom:0 !important;width:100%;}.wrap{padding:0;}.ft{display:inline-block;}@page{size:auto;margin:0mm;}}.selectActive{position:relative;}.selectActive:before{content:"✓";color:#333;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-weight:bold;}</style>
                        <style>${style}</style>
                        <body>${prnhtml}</body>`);


        doc.write(`${document.innerHTML}`);
        // doc.body.innerHTML = prnhtml
        // doc.head.innerHTML = head
        doc.close();

        iframe.contentWindow.focus();

        printPage(iframe.contentWindow);
        if (navigator.userAgent.indexOf("MSIE") > 0) {
          document.body.removeChild(iframe);
        }
      },
      guanBi() {
        if (this.delIds.length === 0) {
          this.$Message.warning({
            content: `请选择至少一项数据`,
            duration: 6,
            closable: true
          });
          return false;
        }
      },
      wanGong() {
        if (this.delIds.length === 0) {
          this.$Message.warning({
            content: `请选择至少一项数据`,
            duration: 6,
            closable: true
          });
          return false;
        }
      },
      //导出
      exportTemplateClick() {
        let params = {
          ...this.searchParams
        };
        if (params['status'] === '全部') {
          params['status'] = '';
        }
        const filName = "投料计划";
        exportApi(params).then(res => {
          fileDownload(res, filName + ".xlsx");
        });
      },
    }
  };
</script>

<style scoped lang="scss">
.ivu-input-number {
	width: -webkit-fill-available;
}
</style>
